/*oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO*/
/*
Created by Amnon Drory for the course "Introduction To Systems Programming", 
School of Electrical Engineering, Tel-Aviv University. winter 2012.
*/
/*oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO*/

#ifndef HW1_INPUT_MANAGER_H
#define HW1_INPUT_MANAGER_H

/*oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO*/

#include "Hw1Types.h" 

/*oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO*/

/**
 * InptMgr_Initialize Initializes the Input Manager. 
 * REMARK: This function must be called only once.
 *
 * Input:
 * -----
 * A string used to initialize the output manager ( should be supplied to you 
 * from outside your program ).
 */ 
void InptMgr_Initialize( const char* SetupString );

/**
 * InptMgr_GetNextRequest Returns the next command from input, in a TRequest struct. 
 *
 * Output Fields:
 * -------------
 * .Operation     IM_END_OF_INPUT: No command, there is no more input.
 *                IM_SELL_TO_CUSTOMER: A costumer is requesting to buy a product from the store.
 *                                     The details of the request are in .TransactionData
 *                IM_BUY_FROM_SUPPLIER: A supplier is offering to sell the store a product.
 *                                      The details of the request are in .TransactionData
 *                IM_CREATE_INVENTORY_FILE: The store is requested to save its current inventory 
 *                                          to a file. The name of the file is in .Filename. 
 *                                          IMPORTANT: The .Filename string is in dynamic memory. 
 *                                          The caller of this function must release the memory 
 *                                          when the string is no longer needed.
 *                IM_ADD_INVENTORY_FROM_FILE   : The store is requested to add to its inventory 
 *                                               the products described in a file. The name of 
 *                                               the file is in .Filename. IMPORTANT: The .Filename 
 *                                               string is in dynamic memory. The caller of this 
 *                                               function must release the memory when the string 
 *                                               is no longer needed.
 *    .TransactionData - will contain the details of a transaction if the .Operation field is
 *                       set to IM_SELL_TO_CUSTOMER or IM_BUY_FROM_SUPPLIER
 *    .Filename    - Will point to a string in dynamically allocated memory, if the .Operation
 *                  field is set to IM_CREATE_INVENTORY_FILE or IM_ADD_INVENTORY_FROM_FILE. Otherwise will be set 
 *                  to NULL. IMPORTANT: the caller of this function must release the memory used
 *                  by this string when it is no longer needed.
 */ 
TRequest InptMgr_GetNextRequest();

/**
 * Releases all memory used by the Input Manager. 
 * It should be called after finishing to read all input (that is,
 * after InptMgr_GetNextRequest() returns a struct with field .Operation set
 * to IM_END_OF_INPUT ).
 * REMARK: This function must be called only once.
 */ 
void InptMgr_CleanUp();

/*oOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoOoO*/

#endif // HW1_INPUT_MANAGER_H